package main

import (
	"bufio"
	"flag"
	"os"
)

var (
	fileName					  = flag.String("file","../info8.log","the replay file .")
	line                          = flag.Int("line", 5000000, "the line of read.")
)

func main()  {
	flag.Parse()
	f,_ := os.Open(*fileName)
	bfRd:= bufio.NewReader(f)
	fileObj,_ := os.OpenFile(*fileName+"_bak",os.O_RDWR|os.O_CREATE|os.O_APPEND,0644)
	for i:=0;i<*line ;i++  {
		line, err := bfRd.ReadBytes('\n')
		if err != nil {
			break
		}
		fileObj.Write(line)
	}
	f.Close()
}
